import {courseModel,QueryModelById,CourseTreeModel} from "@/api/app/typescript/courseModel"
import request from '@/utils/request';
import { AxiosPromise } from 'axios';


export function dataApi(queryParams : any) {
    return request({
        url: '/admin/brush/course/list/'+queryParams.subjectId,
        method: 'get'
    });
}

//根据id查询
export function getCourseById(id: any):AxiosPromise<QueryModelById>  {
    return request({
        url: '/admin/brush/course/' + id,
        method: 'get'
    });
}

//新增
export function addCourse(data: any) {
    return request({
        url: '/admin/brush/course',
        method: 'post',
        data: data
    });
}
//修改
export function updateCourse(data: any) {
    return request({
        url: '/admin/brush/course',
        method: 'put',
        data: data
    });
}
//删除
export function deleteCourse(ids: any) {
    return request({
        url: '/admin/brush/course/'+ids,
        method: 'delete'
    });
}

/**
 * 课程树型结构，包含学科信息
 * @return
 */
export function courseTreeApi() {
    return request({
        url: '/admin/brush/course/tree',
        method: 'get'
    });
}
